﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.CMS263.PO;
using Com.CMS263.BLL;
using Com.CMS263.Util;

namespace Com.CMS263.Web.manage
{
    public partial class ModClass : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                int id = int.Parse(Request["id"]);
                Classes classes = (new ClassesBLL()).GetClassByID(id);
                this.txtClassName.Text = classes.title;
                this.txtOpenType.Text = classes.openTime;
                this.txtTypeName.Text = classes.typeName;
                this.con.Value = classes.content;
                this.hdfid.Value = id.ToString();
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            ClassesBLL bll = new ClassesBLL();

            string typeName = this.txtTypeName.Text;
            string className = this.txtClassName.Text;
            string openData = this.txtOpenType.Text;
            string content = this.con.Value;
            Classes classes = bll.GetClassByID(int.Parse(this.hdfid.Value));
            classes.openTime = openData;
            classes.title = className;
            classes.typeName = typeName;
            classes.content = this.con.Value;
            classes.addDate = DateTime.Now;
           bll.Modify(classes);
            StringUtil.Alert("修改成功", "manageClass.aspx");
        }
    }
}
